#ifndef _LSUP_NT_PARSER_H
#define _LSUP_NT_PARSER_H

#include "codec.h"


/** @brief Parse a single term.
 *
 * @param[in] rep N-Triples representation as a character string.
 *
 * @param[in] map Unused: there is no namespace prefixing in N-triples. Kept
 *  for interface compatibility. May be NULL.
 *
 * @param[out] term Term to be created from the string.
 *
 * @return LSUP_OK on success, LSUP_VALUE_ERR if the string is not valid
 *  N-Triples syntax for a IRI ref, Literal or BNode.
 */
LSUP_rc
LSUP_nt_parse_term (const char *rep, const LSUP_NSMap *map, LSUP_Term **term);


/** @brief Parse a N-Triples document from a file handle.
 *
 * @param[in] doc N-Triples document.
 *
 * @param[out] Pointer to a graph handle to be created. The new graph will have
 *  a random UUID URN.
 *
 * @param[out] ct If not NULL it is populated with the number of triples
 *  parsed. This may be more than the triples in the resulting graph.
 *
 * @return LSUP_OK on success, LSUP_VALUE_ERR if a parsing error was
 *  encountered. TODO Add line/char info for parsing error
 */
LSUP_rc
LSUP_nt_parse_doc (FILE *stream, LSUP_Graph **gr, size_t *ct, char **err);

#endif
